home *** CD-ROM | disk | FTP | other *** search
/ Mac Magazin/MacEasy 32 / Mac Magazin and MacEasy Magazine CD - Issue 32.iso / Multimedia / PlayerPRO 4.5.5 Dev.Kit / Plug-Ins / Music Import⁄Export Plugs / FileUtilsMac.c < prev    next >
C/C++ Source or Header  |  1997-02-25  |  2KB  |  110 lines

  1. #include "FileUtils.h"
  2.  
  3. short iFileOpen( Ptr name)
  4. {
  5.     short temp;
  6.     OSErr    iErr;
  7.     
  8.     c2pstr( name);
  9.     iErr = FSOpen( (unsigned char*) name, 0, &temp);
  10.     p2cstr( (unsigned char*) name);
  11.     
  12.     if( iErr) return 0;
  13.     else return temp;
  14. }
  15.  
  16. long iGetEOF( short iFileRefI)
  17. {
  18.     long curEOF;
  19.     
  20.     GetEOF( iFileRefI, &curEOF);
  21.     
  22.     return curEOF;
  23. }
  24.  
  25. OSErr iRead( long size, Ptr dest, short iFileRefI)
  26. {
  27.     return FSRead( iFileRefI, &size, dest);
  28. }
  29.  
  30. OSErr iSeekCur( long size, short iFileRefI)
  31. {
  32.     return SetFPos( iFileRefI, fsFromMark, size);
  33. }
  34.  
  35. void iFileCreate( Ptr name, long type)
  36. {
  37.     c2pstr( name);
  38.     
  39.     FSDelete( (unsigned char*)name, 0L);
  40.     Create( (unsigned char*) name, 0, 'SNPL', type);
  41.     
  42.     p2cstr( (unsigned char*) name);
  43. }
  44.  
  45. OSErr iWrite( long size, Ptr dest, short iFileRefI)
  46. {
  47.     return FSWrite( iFileRefI, &size, dest);
  48. }
  49.  
  50. void iClose( short iFileRefI)
  51. {
  52.     FSClose( iFileRefI);
  53. }
  54.  
  55. /////////////////////////////////
  56.  
  57. void MOT32( void *msg_buf)
  58. {
  59. }
  60.  
  61. void MOT16( void *msg_buf)
  62. {
  63. }
  64.  
  65. /////////////////////////////////
  66.  
  67. void INT32( void *msg_buf)
  68. {
  69.   unsigned char     *buf = msg_buf;
  70.   unsigned long        out;
  71.   
  72.   out = ( (unsigned long) buf[3] << 24) | ( (unsigned long) buf[2] << 16) | ( (unsigned long) buf[ 1] << 8) | ( (unsigned long) buf[0]);
  73.     *((unsigned long*) msg_buf) = out;
  74. }
  75.  
  76. void INT16( void *msg_buf)
  77. {
  78.   unsigned char     *buf = msg_buf;
  79.   short                        out;
  80.   
  81.   out =  ( (short) buf[1] << 8) | ( (short) buf[0]);
  82.   *((short*) msg_buf) = out;
  83. }
  84. /////////////////////////////////
  85.  
  86. #ifndef __SHUDDUPH__
  87. Ptr strcpy( Ptr dst, const char* src)
  88. {
  89.     long i = 0;
  90.     
  91.     do
  92.     {
  93.         dst[ i] = src[ i];
  94.     }while( src[ i++]);
  95.     
  96.     return dst;
  97. }
  98.  
  99. int strcmp( const char *dst, const char* src)
  100. {
  101.     long i = 0;
  102.     
  103.     do
  104.     {
  105.         if( dst[ i] != src[ i]) return -1;
  106.     }while( src[ i++]);
  107.     
  108.     return 0;
  109. }
  110. #endif